flowbox: Avoid a crash in measure()
authorMatthias Clasen <mclasen@redhat.com>
Thu, 14 May 2020 00:32:30 +0000 (20:32 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Thu, 14 May 2020 01:47:11 +0000 (21:47 -0400)
When the children request a height of zero, the
flowbox measure() function was happily dividing
by that zero, leading to badness.

gtk/gtkflowbox.c

index 26b78e3fa38525de6eb0653c0c435ca4acc27945..5c022d45cd6f44913d36b32bbe040fa9213ae916 100644 (file)
@@ -2075,6 +2075,8 @@ gtk_flow_box_measure (GtkWidget      *widget,
                 goto out_width;
 
               get_max_item_size (box, GTK_ORIENTATION_VERTICAL, &min_item_height, &nat_item_height);
+              if (nat_item_height <= 0)
+                goto out_width;
 
               /* By default flow at the natural item width */
               line_length = avail_size / (nat_item_height + priv->row_spacing);